home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 May: Tool Chest / Dev.CD May 98 TC.toast / Tool Chest / Networking / MacTCP / MPing 1.1 / Sources / MiscIPPB.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-09-30  |  2.8 KB  |  110 lines  |  [TEXT/MPS ]

  1. /* 
  2.     IPPB.h    
  3.     C definitions of parameter block entries needed for IP calls
  4.  
  5.     Copyright Apple Computer, Inc. 1988-91 
  6.     All rights reserved
  7.     modified by Rajesh Bhatawadekar Sept 25, 1991
  8. */
  9.  
  10. /* control codes */
  11. #define ipctlGetAddr        15            /* csCode to get our IP address */
  12. #define ipctlEchoICMP        17            /* send icmp echo */
  13. #define ipctlLAPStats        19            /* get lap stats */
  14.  
  15. #define icmpEchoTimeoutErr         -23035            /* ICMP echo timed-out */
  16.  
  17. #define ParamBlockHeader     \
  18.     struct QElem *qLink;     \
  19.     short qType;             \
  20.     short ioTrap;             \
  21.     Ptr ioCmdAddr;             \
  22.     ProcPtr ioCompletion;     \
  23.     OSErr ioResult;         \
  24.     StringPtr ioNamePtr;     \
  25.     short ioVRefNum;        \
  26.     short ioCRefNum;        \
  27.     short csCode
  28.     
  29. typedef void (*ICMPEchoNotifyProc) (struct ICMPParamBlock *iopb);
  30.  
  31.  
  32. struct IPParamBlock {
  33.     ParamBlockHeader;                    /* standard I/O header */
  34.     union {
  35.         struct {
  36.             ip_addr    dest;                /* echo to IP address */
  37.             wdsEntry data;
  38.             short timeout;
  39.             Ptr options;
  40.             unsigned short optLength;
  41.             ICMPEchoNotifyProc icmpCompletion;
  42.             unsigned long userDataPtr;
  43.             } IPEchoPB;
  44.         struct {
  45.             struct LAPStats *lapStatsPtr;
  46.             } LAPStatsPB;
  47.         } csParam;
  48.     };
  49.  
  50. struct ICMPParamBlock {
  51.     ParamBlockHeader;                    /* standard I/O header */
  52.     short params[11];
  53.     struct {
  54.         unsigned long echoRequestOut;    /* time in ticks of when the echo request went out */
  55.         unsigned long echoReplyIn;        /* time in ticks of when the reply was received */
  56.         struct rdsEntry echoedData;        /* data received in responce */
  57.         Ptr options;
  58.         unsigned long userDataPtr;
  59.         } icmpEchoInfo;
  60.     };
  61.  
  62. struct IPParamBlock1 {
  63.     ParamBlockHeader;            /* standard I/O header */
  64.     ip_addr    ourAddress;            /* our IP address */
  65.     long    ourNetMask;            /* our IP net mask */
  66.     };
  67.  
  68.  
  69. typedef struct LAPStats {
  70.     short    ifType;
  71.     char    *ifString;
  72.     short    ifMaxMTU;
  73.     long    ifSpeed;
  74.     short    ifPhyAddrLength;
  75.     char    *ifPhysicalAddress;
  76.     union {
  77.         struct arp_entry *arp_table;    
  78.         struct nbp_entry *nbp_table;
  79.         } AddrXlation;
  80.     short    slotNumber;
  81.     };
  82.     
  83. #define NBP_TABLE_SIZE    20                /* number of NBP table entries */
  84. #define NBP_MAX_NAME_SIZE    16+10+2
  85.  
  86. struct nbp_entry {
  87.     ip_addr     ip_address;                /* IP address */
  88.     AddrBlock    at_address;                /* matching AppleTalk address */
  89.     Boolean        gateway;                /* TRUE if entry for a gateway */
  90.     Boolean        valid;                    /* TRUE if LAP address is valid */
  91.     Boolean        probing;                /* TRUE if NBP lookup pending */
  92.     int            age;                    /* ticks since cache entry verified */
  93.     int            access;                    /* ticks since last access */
  94.     char        filler[116];            /* for internal use only !!! */
  95.     };
  96.  
  97. #define ARP_TABLE_SIZE    20                /* number of ARP table entries */
  98.  
  99. typedef struct Enet_addr {
  100.     b_16 en_hi;
  101.     b_32 en_lo;
  102.     } Enet_addr;
  103.  
  104. typedef struct arp_entry {
  105.     short        age;            /* cache aging field */
  106.     b_16        protocol;        /* Protocol type */
  107.     ip_addr     ip_address;        /* IP address */
  108.     Enet_addr    en_address;        /* matching Ethernet address */
  109.     };
  110.